// 楼宇信息
import qs from 'qs'
import request from '@/utils/request'
// 配置公共的header
const headers = {
  'Content-Type': 'application/json;charset=utf-8'
}
/**
 * @name treeData
 * @description 菜单树形结构
 * @author wqy
 * @date 2019-09-18 16:14:43
 */
export function treeData(data = {}) {
  return request({
    url: '/web/sysPermission/all',
    method: 'get',
    params: data
  })
}
/**
 * @name enable
 * @description 启用
 * @author wqy
 * @date 2019-09-18 16:14:43
*/
export function enable(data) {
  return request({
    url: '/web/sysPermission/enable',
    method: 'get',
    params: data
  })
}
/**
 * @name disable
 * @description 禁用
 * @author wqy
 * @date 2019-09-18 16:14:43
*/
export function disable(data) {
  return request({
    url: '/web/sysPermission/disable',
    method: 'get',
    params: data
  })
}
/**
 * @name add
 * @description 新增
 * @author wqy
 * @date 2019-09-18 16:14:43
*/
export function add(data) {
  return request({
    url: '/web/sysPermission/add',
    method: 'post',
    data: data,
    ...headers
  })
}
/**
 * @name edit
 * @description 编辑
 * @author wqy
 * @date 2019-09-18 16:14:43
*/
export function edit(data) {
  return request({
    url: '/web/sysPermission/edit',
    method: 'post',
    data: data,
    ...headers
  })
}
const url = '/web/sysPermission/'
/**
 * @name addButton
 * @description 添加按钮权限
 * @author cjs1992
 * @date 2019-12-02 17:21:08
 */
export function addButton(data = {}) {
  return request({
    method: 'post',
    url: `${url}addButton`,
    data: data,
    ...headers
  })
}
/**
 * @name getPermissionButton
 * @description 获取按钮权限
 * @author cjs1992
 * @date 2019-12-02 17:25:09
 */
export function getPermissionButton(data = {}) {
  return request({
    method: 'get',
    url: `${url}getPermissionButton`,
    params: data
  })
}
/**
 * @name getRolePermissionButton
 * @description 根据route_id和roleId获取选中的按钮权限
 * @author cjs1992
 * @date 2019-12-03 10:23:01
 */
export function getRolePermissionButton(data = {}) {
  return request({
    method: 'get',
    url: `${url}getRolePermissionButton`,
    params: data
  })
}
